home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 264_01 / tr.doc < prev    next >
Text File  |  1980-01-01  |  2KB  |  39 lines

  1. TR
  2.  
  3. Purpose
  4. transliterate characters
  5.  
  6. Syntax
  7. tr [-bcds] [inset [outset]]
  8.  
  9. Comments
  10. Tr is a filter (it reads from the standard input and writes to the
  11. standard output) which can substitute for or delete selected characters.
  12. Input characters which are in string inset are mapped to characters in
  13. string outset.  If outset is shorter than the length of inset, it is
  14. padded to that length with its last character.
  15.  
  16. Inset and outset may contain ranges of characters in the form a-b, where
  17. a and/or b may be omitted, and octal numbers of the form \ooo, where ooo
  18. is 1-3 octal digits.  Combining the two (e.g., \1-\5) is allowed.  '\'
  19. followed by a character other than an octal digit is simply translated
  20. to that character.  Nulls are acceptable both in the input stream and in
  21. the arguments (in the form of an octal escape). 
  22.  
  23. Options:
  24. -b      operate in binary mode (default is text mode)
  25. -c      complement inset with respect to 1-0377 octal (in ASCII order)
  26. -d      delete all occurrences of characters in inset
  27. -s      squeeze repeated characters in outset to single character on output
  28.  
  29. Examples:
  30. Create a list of all the words in infile, one per line, in outfile,
  31. where a word is taken to be a maximal string of alphabetics (012 is the
  32. ASCII code for newline):
  33.  
  34.     tr -cs A-Za-z \012 < infile > outfile
  35.  
  36. Copy infile to outfile with all nonprinting characters removed:
  37.  
  38.     tr -d \1-\11\13-\37\177-\377 < infile > outfile
  39.